package com.openscorer;
public abstract class Scorable {
	public class ScorableTypeException extends RuntimeException {
		private static final long serialVersionUID = 1L;
	}
	// Returns the name of the Scorable
	public abstract String getName();
	public abstract FormattingOptions getFOptions();
	public abstract void visit(ScorableVisitor v);
	public abstract Scorable deepCopy();
	
	// These methods are each only valid for a single subclass of
	// Scorable, but have signatures here so that the caller doesn't
	// have to cast Scorables. This essentially implementing duck-typing
	//
	// Only present for Bool type.
	public boolean bool() throws ScorableTypeException {
		throw new ScorableTypeException();
	}
	// Only present for Int type
	public int num() throws ScorableTypeException {
		throw new ScorableTypeException();
	}
	// Only present for Enumerated type
	public String which() throws ScorableTypeException {
		throw new ScorableTypeException();
	}
	// Only present for Repeated type
	public Scorable round(int i) throws ScorableTypeException {
		throw new ScorableTypeException();
	}
	public int num_rounds()  throws ScorableTypeException {
		throw new ScorableTypeException();
	}
	// Only present for Structure type
	public Scorable get(String name) throws ScorableTypeException {
		throw new ScorableTypeException();
	}
}
